package com.chuangjiangx.member.manager.client.web.basic.request.aiface;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * 人脸识别请求参数
 *
 * @author 马文韬
 * @version 1.0
 * @date: 2018/9/13
 */
@Getter
@Setter
@ApiModel(value = "人脸识别请求参数")
public class FaceRecognitionRequest {

    public static int IMG_TYPE_FILE_URL = 0;
    public static int IMG_TYPE_STREAM = 1;

    @NotNull(message = "图片传输类型不能为空")
    @Min(value = 0, message = "未定义的文件传输类型")
    @Max(value = 1, message = "未定义的文件传输类型")
    @ApiModelProperty(value = "传输图片的类型, 0 - 文件Url， 1 - 图片Base64流", allowableValues = "0,1", required = true)
    private Integer imgType;

    @ApiModelProperty("需要识别的人脸图片的Base64流,Type为1时必须传入")
    private String faceImgStream;

    @ApiModelProperty("人脸识别图片Url,Type为0时必须传入")
    private String faceImgUrl;

    @ApiModelProperty("手机号后四位接收验证")
    private String theLastPhoneNumber;

    public boolean typeIsFileUrl() {
        return imgType == IMG_TYPE_FILE_URL;
    }

    public boolean typeIsStream() {
        return imgType == IMG_TYPE_STREAM;
    }

}
